<template>
  <el-radio
    v-bind="$attrs"
    v-model="radioValue"
    :label="label"
    :disabled="disabled"
    :border="border"
    :size="size"
    :name="name"
    :validate-event="validateEvent"
    @change="handleChange"
  >
    <slot />
  </el-radio>
</template>

<script>
export default {
  name: 'MyElRadio',
  inheritAttrs: false,
  props: {
    modelValue: {
      type: [String, Number, Boolean],
      default: ''
    },
    label: {
      type: [String, Number, Boolean],
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    },
    border: {
      type: Boolean,
      default: false
    },
    size: {
      type: String,
      default: 'default',
      validator: (value) => {
        return ['large', 'default', 'small'].includes(value)
      }
    },
    name: {
      type: String,
      default: ''
    },
    validateEvent: {
      type: Boolean,
      default: true
    }
  },
  emits: ['update:modelValue', 'change'],
  computed: {
    radioValue: {
      get() {
        return this.modelValue
      },
      set(value) {
        this.$emit('update:modelValue', value)
      }
    }
  },
  methods: {
    handleChange(value) {
      this.$emit('change', value)
    }
  }
}
</script> 